import request from '@/utils/axios'
import {
  URL_API
} from '@/utils/mUtils'
const base = URL_API()
//审核列表接口
export function ExamineListFn(params) {
  return request({
    url: `${base}/api/examine/list`,
    method: 'post',
    data: params,
  })
}

//创建审核流程
export function ExamineCreateFn(params) {
  return request({
    url: `${base}/api/examine/create`,
    method: 'post',
    data: params,

  })
}

//删除审核流程数据
export function ExamineDelete(params) {
  return request({
    url: `${base}/api/examine/delete`,
    method: 'post',
    data: params,

  })
}
//更新审核流程数据
export function ExamineUpdate(params) {
  return request({
    url: `${base}/api/examine/update`,
    method: 'post',
    data: params,

  })
}

//审核流程详情数据
export function ExamineDetail(params) {
  return request({
    url: `${base}/api/examine/detail`,
    method: 'post',
    data: params,

  })
}
// 应付详情数据
export function PayableDetail(params) {
  return request({
    url: `${base}/api/finance/payable/record/detail`,
    method: 'post',
    data: params,

  })
}
//审核流程详情数据
export function ReimburseDetail(params) {
  return request({
    url: `${base}/api/finance/reimburse/detail`,
    method: 'post',
    data: params,
  })
}
//动态数据
export function DropData(params, url) {
  return request({
    url: `${base}${url}`,
    method: 'post',
    data: params,
  })
}
//审核记录列表
export function ExamineRecordList(params) {
  return request({
    url: `${base}/api/examine/record/list`,
    method: 'post',
    data: params,

  })
}

//审核记录详情
export function ExamineRecordDetail(params) {
  return request({
    url: `${base}/api/examine/record/detail`,
    method: 'post',
    data: params,

  })
}
//审核记录详情
export function ExamineCondition(params) {
  return request({
    url: `${base}/api/examine/condition`,
    method: 'post',
    data: params,
  })
}


//审核是否通过函数
export function ExamineRecordUpdate(params) {
  return request({
    url: `${base}/api/examine/record/update`,
    method: 'post',
    data: params,

  })
}

//签章管理列表接口
export function signatureList(params) {
  return request({
    url: `${base}/api/reportdata/signature/list`,
    method: 'post',
    data: params,

  })
}
//签章创建接口函数
export function signatureCreateFn(params) {
  return request({
    url: `${base}/api/reportdata/signature/create`,
    method: 'post',
    data: params,

  })
}

//删除签章管理数据
export function DeleteSignature(params) {
  return request({
    url: `${base}/api/reportdata/signature/delete`,
    method: 'delete',
    data: params,

  })
}

//修改签章函数接口
export function UpdateSignature(params) {
  return request({
    url: `${base}/api/reportdata/signature/update`,
    method: 'put',
    data: params,

  })
}

//
export function DetailSignature(params) {
  return request({
    url: `${base}/api/reportdata/signature/detail`,
    method: 'post',
    data: params,

  })
}

//报告列表函数
export function ReportmanageList(params) {
  return request({
    url: `${base}/api/reportdata/reportmanage/list`,
    method: 'post',
    data: params,

  })
}
// 动态表头接口调用
export function dynamicState(url, url_param) {
  const jsonObject = JSON.parse(url_param || '{}');
  const firstKey = Object.keys(jsonObject);
  if (firstKey[0] == 'codes') {
    jsonObject.codes = jsonObject.codes.substring(1, jsonObject.codes.length - 1).split(',');
  } else if (firstKey[0] == 'is_all') {
    jsonObject.is_all = false;
  } else if (firstKey[0] == 'show_employee') {
    jsonObject.show_employee = false;
    if (firstKey[1] == 'not_show_first_branch') {
      jsonObject.not_show_first_branch = 1
    }
  }
  else {

  }
  return request({
    url: `${base}${url}`,
    method: 'post',
    data: jsonObject,
  })
}
// 接口远程收索
export function longRangeSearch(url, url_param) {
  // // console.log(`${base}${url}`)
  // // console.log(url_param)
  return request({
    url: `${base}${url}`,
    method: 'post',
    data: url_param,

  })
}